/*
 * Attribute uses
 * TYPE    MIN        MAX        SPEED
 * WEAPON  Min damage Max damage pause between swings in seconds
 * ARMOR   not used   not used   not used
 * HEALING Min healed Max healed not used
 */

package com.camelspit.preludetoarmageddon.entity;
import java.util.Arrays;
/**
 *
 * @author DMK
 */
public class Item extends BaseEntity{
    private ItemType type;
    private int min;
    private int max;
    private int speed;
    private Money price;
    public static EntityAttributes attributes;

    /**
     * Initialize Item with invalid values
     */
    public Item() {
        type = null;
        min = -1;
        max = -1;
        price = null;
        attributes = new EntityAttributes();
    }

    public ItemType type() {return type;}
    public void setType(ItemType type) {this.type = type;}
    public void setType(String type) {
        if(type.equalsIgnoreCase("WEAPON"))
            this.type = ItemType.WEAPON;
        else if(type.equalsIgnoreCase("ARMOR"))
            this.type = ItemType.ARMOR;
        else if(type.equalsIgnoreCase("POTION"))
            this.type = ItemType.POTION;
    }

    public int min() {return min;}
    public void setMin(int min) {this.min = min;}
    public void setMin(String min) {
        int temp = Integer.parseInt(min);
        this.min = temp;
    }

    public int max() {return max;}
    public void setMax(int max) {this.max = max;}
    public void setMax(String max) {
        int temp = Integer.parseInt(max);
        this.max = temp;
    }

    public int speed() {return speed;}
    public void setSpeed(int speed) {this.speed = speed;}
    public void setSpeed(String speed) {
        int temp = Integer.parseInt(speed);
        this.speed = temp;
    }
    public Money price() {return price;}
    public int getAttribute(Attributes attribute) {
        return attributes.getAttribute(attribute);
    }
    public void setAttribute(Attributes attr, int setAttr) {
        attributes.setAttribute(attr, setAttr);
    }
}
